Routines (alphabetical) > Routines: S > S_TEST

S_TEST

Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also

The S_TEST function tests the hypothesis that two sample populations X and Y have the same mean of distribution against the hypothesis that they differ.

This routine is written in the IDL language. Its source code can be found in the file s_test.pro in the lib subdirectory of the IDL distribution.

Syntax

Result = S_TEST( X, Y [, ZDIFF=variable] )

Return Value

The result is a two-element vector containing the maximum number of signed differences between corresponding pairs of xi and yi and its one-tailed significance. This type of test is often referred to as the “Sign Test.”

Arguments

X

An n-element integer, single-, or double-precision floating-point vector.

Y

An n-element integer, single-, or double-precision floating-point vector.

Keywords

ZDIFF

Set this keyword to a named variable that will contain the number of differences between corresponding pairs of xi and yi resulting in zero. Paired data resulting in a difference of zero are excluded from the ranking and the sample size is correspondingly reduced.

Examples

; Define two n-element sample populations:
X = [47, 56, 54, 49, 36, 48, 51, 38, 61, 49, 56, 52]
Y = [71, 63, 45, 64, 50, 55, 42, 46, 53, 57, 75, 60]

; Test the hypothesis that the two sample populations have the same
; mean of distribution against the hypothesis that they differ at
; the 0.05 significance level:
PRINT, S_TEST(X, Y, ZDIFF = zdiff)

IDL prints:

[9.00000, 0.0729981]

The computed probability (0.0729981) is greater than the 0.05 significance level and therefore we do not reject the hypothesis that X and Y have the same mean of distribution.

Version History

4.0

Introduced

See Also

FV_TEST , KW_TEST , MD_TEST , RS_TEST , TM_TEST